//package com.software.graduationproject.commons.util;
//
//import org.springframework.security.core.Authentication;
//import org.springframework.security.core.context.SecurityContext;
//import org.springframework.security.core.context.SecurityContextHolder;
//import org.springframework.security.core.userdetails.UserDetails;
//
//public abstract class SecurityUtils {
//
//    public static Authentication getAuthentication() {
//        SecurityContext securityContext = SecurityContextHolder.getContext();
//        return securityContext != null ? securityContext.getAuthentication() : null;
//    }
//
//    public static <T extends UserDetails> T getPrincipal() {
//        Authentication authentication = getAuthentication();
//        return authentication != null ? (T) authentication.getPrincipal() : null;
//    }
//
//    private static final ThreadLocal<Boolean> loginSuccess = new ThreadLocal<>();
//
//    public static void setLoginSuccess() {
//        loginSuccess.set(true);
//    }
//
//    public static boolean isLoginSuccess() {
//        return Boolean.TRUE.equals(loginSuccess.get());
//    }
//
//    public static void clearLoginSuccess() {
//        loginSuccess.remove();
//    }
//}
//
//
